<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>


<script>


  /*
  let count = 1
  let obj = {
    count
    // count: count
  }
  console.log(obj)*/

  // let p1 = (name, age) => ({name: name, age: age})
  // let p1 = (name, age) => ({name, age})
  // console.log(p1('张三', 38))

  /*
  let testKey = 'name'
  let obj = {
    [testKey]: '张三'
  }
  obj['a' + 'bc'] = 'abc val'
  console.log(obj)
  */

  /*
  let obj = {
    a: 1,
    b: 2,
    c: 3,
  }
  const { c, ...other } = obj
  console.log(c)
  console.log(other)*/

  let obj = {
    a: 1,
    b: 2,
    c: 3,
  }
  // let obj1 = obj
  // 对象拷贝
  // let obj1 = {...obj}
  // let obj1 = Object.assign({}, obj)
  // Object.assign(target, source1, source2, ...)
  // obj1.a = 100
  // console.log(obj)
  // console.log(obj1)


  let s1 = {
    color: 'red',
    // a: 123
  }
  let s2 = {
    sayHi() {
      alert('hi')
    },
    a: 999
  }

  obj = Object.assign({}, obj, s2, s1)


  // console.log(obj)
  // console.log('--------------')
  // console.log(Object.keys(obj))
  // Object.keys(obj).forEach(item => console.log(obj[item]))

  // console.log(Object.values(obj))
  // console.log(Object.entries(obj))

  /*
  let str = '?cl=3&tn=baidutop10&fr=top1000&wd=%E4%B8%AD%E5%9B%BD%E6%AD%A3%E8%83%BD%E9%87%8F&rsv_idx=2&rsv_dl=fyb_n_homepage&hisfilter=1'
  let query = []
  let arr = str.slice(1).split('&')
  arr.forEach(item => {
    query.push(item.split('='))
  })
  console.log(Object.fromEntries(query).wd)
  */


  // ...[]
  // ...{}
  // ...''
  // Object.assign()


  /*obj = {
    ...obj,
    ...s1,
    ...s2
  }*/
  // console.log(obj)


  /*
  let z = {
    // name: 'zzz',
    ...obj
  }
  console.log(z === obj)*/


</script>
</body>
</html>